package com.DosonLeung.homeschoolcommunication.Views;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import android.widget.ScrollView;

import com.DosonLeung.homeschoolcommunication.Components.TestAdapter;

/**
 * Created by dosonleung on 12/15/14.
 */
public class ChatLayout extends LinearLayout{
    private ChatLayout self = this;

    public ChatLayout(Context context) {
        super(context);
    }

    public ChatLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public void setAdapter(TestAdapter adapter){
        adapter.init();
    }

    public void smoothScrollToButtom() {
        final ScrollView parent = (ScrollView)self.getParent();
        self.post(new Runnable() {
            @Override
            public void run() {
                parent.fullScroll(FOCUS_DOWN);
            }
        });
    }

    private int getDistance(){
        return self.getHeight();
    }

}
